//! Integration example for rust-ploop-processor with debug macros
//!
//! This example demonstrates how to use rust-ploop-processor's debug macros.
//! Run with `--features debug` to see debug output, otherwise all debug logs are disabled.

use rust_ploop_processor::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Example vertices (simulating POLYLINE_GENERATION)
    let vertices = vec![
        Vertex { x: 0.0, y: 0.0, z: 0.0 },
        Vertex { x: 1.0, y: 0.0, z: 0.0 },
        Vertex { x: 1.0, y: 1.0, z: 0.0 },
        Vertex { x: 0.0, y: 1.0, z: 0.0 },
    ];
    
    debug_println!("🔧 rust-ploop-processor 处理完成，得到 {} 个顶点", vertices.len());
    
    // Convert to Polyline
    debug_println!("🔧 将 {} 个处理后的顶点转换为 Polyline", vertices.len());
    let polyline = Polyline::new(vertices.clone());
    debug_println!("✅ Polyline 转换完成，包含 {} 个顶点", polyline.vertices.len());
    
    // Process with rust-ploop-processor
    debug_println!("🔧 使用 rust-ploop-processor 统一处理 {} 个顶点", polyline.vertices.len());
    
    let processed_vertices = process_ploop_vertices(&polyline.vertices)?;
    debug_println!("🔧 开始处理PLOOP顶点: POLYLINE_GENERATION");
    debug_println!("   输入顶点数: {}", polyline.vertices.len());
    debug_println!("   处理后顶点数: {}", processed_vertices.len());
    
    // Count FRADIUS vertices (0 in this example)
    let fradius_count = 0;
    debug_println!("   其中包含 {} 个FRADIUS顶点", fradius_count);
    debug_println!("✅ PLOOP顶点处理完成，返回 {} 个顶点", processed_vertices.len());
    debug_println!("   rust-ploop-processor 处理完成，得到 {} 个顶点", processed_vertices.len());
    
    Ok(())
}

/// Example function to process PLOOP vertices
fn process_ploop_vertices(vertices: &[Vertex]) -> Result<Vec<Vertex>, String> {
    // In a real implementation, this would call the actual rust-ploop-processor
    // For now, just return the same vertices as an example
    Ok(vertices.to_vec())
}
